package com.tomehay.termprojectmanage_server.controller;


import com.tomehay.termprojectmanage_server.pojo.Model.Clazz;
import com.tomehay.termprojectmanage_server.pojo.VO.ResultVO;
import com.tomehay.termprojectmanage_server.service.ClazzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tomehay
 * @since 2023-06-20
 */
@RestController
@RequestMapping("api/clazz")
public class ClazzController {

    @Autowired
    ClazzService clazzService;

    @GetMapping("/GetAllClazz")
    public ResultVO<List<Clazz>> GetAllClazz(){
        return clazzService.GetAllClazz();
    }

    @DeleteMapping("/RemoveClazz")
    public ResultVO<Void> RemoveClazz(int id){
        return clazzService.removeClazz(id);
    }

    @PostMapping("/CreateClazz")
    public ResultVO<Void> CreateClazz(@RequestBody Clazz clazz){
        return clazzService.CreateClazz(clazz);
    }
}
